<!DOCTYPE HTML>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<map name="imagemap1">
  <area shape="rect" coords="10,20,100,30" href="#" title="Link1" />
  <area shape="rect" coords="30,40,100,50" href="#" title="Link2" />
</map>

<img src="resources/cake.png" usemap="#imagemap1" style="position: absolute; left: 200px; top: 100px;">

<script>
function findAllImageMapLinks(node, list) {
  if (node.role == "AXRole: AXLink")
    list.push(node);
  for (var i = 0; i < node.childrenCount; i++)
    findAllImageMapLinks(node.childAtIndex(i), list);
}

test(function(t) {
  var links = [];
  findAllImageMapLinks(accessibilityController.rootElement, links);

  assert_equals(links.length, 2);
  assert_equals(links[0].name, "Link1");
  assert_equals(links[0].x, 210);
  assert_equals(links[0].y, 120);
  assert_equals(links[1].name, "Link2");
  assert_equals(links[1].x, 230);
  assert_equals(links[1].y, 140);
}, "Test bounds of image map links");
</script>

</body>
</html>
